#include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
  int rev(int x)
  {
    int ans = 0;
    while (x)
    {
      ans *= 10;
      ans += x % 10;
      x /= 10;
    }
    return ans;
  }
  int countNicePairs(vector<int> &nums)
  {
    long long tmp;
    long long ans = 0;
    unordered_map<long long, int> cnt;
    for (int i = 0; i < nums.size(); i++)
    {
      tmp = 1ll - rev(nums[i]) + nums[i];
      ans += cnt[tmp]++;
      ans %= (int)(1e9 + 7);
    }
    return ans;
  }
};
int main()
{
  Solution s;

  return 0;
}
